package com.ccy.product.web;

import com.ccy.product.service.CategoryService;
import com.ccy.product.vo.Catalog2Vo;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author coder_ccy
 * @date 2022/7/18 10:22
 */
@Controller
public class IndexController implements InitializingBean {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;


    @Autowired
    private CategoryService categoryService;


    @GetMapping({"","index.html"})
    public String index(){
        return "index";   // /temps/index.html
    }


    @GetMapping("/index/getIndexCatalogs")
    @ResponseBody
    public Map<String, List<Catalog2Vo>> getIndexCatalogs(){

        return categoryService.getIndexCatalogs();

    }

    @Override
    public void afterPropertiesSet() throws Exception {

    }
}
